#!/bin/bash
# 快速登录竹马法考爬虫

echo "=== 竹马法考快速登录 ==="
echo ""
echo "请从浏览器复制 cookies 字符串："
echo "1. 访问 https://www.zhumavip.com 并登录"
echo "2. 按 F12 → Network 标签"
echo "3. 找到任意请求，查看 Request Headers"
echo "4. 复制 Cookie: 后面的完整内容"
echo ""
read -p "请输入你的用户名: " username
echo ""
read -p "请粘贴 cookies 字符串: " cookies_str

echo ""
echo "正在登录..."

response=$(curl -s -X POST "http://localhost:8000/api/v1/scraper/login" \
  -H "Content-Type: application/json" \
  -d "{
    \"username\": \"$username\",
    \"cookies_str\": \"$cookies_str\"
  }")

echo "$response" | python3 -m json.tool 2>/dev/null || echo "$response"

echo ""
echo "检查登录状态..."
curl -s "http://localhost:8000/api/v1/scraper/login-status" | python3 -m json.tool

